
#ifndef DDOFFICE_DD_JWTTOKEN_H
#define DDOFFICE_DD_JWTTOKEN_H

#include <iostream>
#include <string>
#include <chrono>
#include <iomanip>
#include <sstream>
#include <openssl/hmac.h>
#include <openssl/evp.h>
#include <openssl/aes.h>
#include <openssl/rand.h>
#include "hv/json.hpp"
#include <CommonCrypto/CommonDigest.h>
#include <openssl/sha.h>
#include "number.h"

using json = nlohmann::json;
using namespace std;

class DDJwtToken
{
private:
    string secretKey;
    bool verifySignature(const std::string &payloadStr, const std::string &signature, const std::string &secretKey);

public:
    DDJwtToken(string secret);
    DDJwtToken();
    ~DDJwtToken();
    string generateToken(const std::string &userId);
    bool verifyToken(const std::string &token, std::string &userId);
    bool verifyTokenWithSignature(const std::string &original_token,const std::string &userId, const string &u_singature,  string &msg);
};

#endif